/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@SQL}}.java.hbs
 */
package cn.ibizlab.core.authentication.domain;

import java.util.*;
import cn.ibizlab.util.domain.IEntity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.EntityMP;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * 统一认证/外部认证实体类[AuthProvider]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@TableName(value = "OPEN_ACCESS_PROVIDER", resultMap = "AuthProviderResultMap")
@ApiModel(value = "AUTH_PROVIDER", description = "统一认证/外部认证")
public class AuthProvider extends EntityMP implements Serializable
{

    /**
     * 应用标识
     */
    @Id
    @TableId(value = "id" , type = IdType.ASSIGN_UUID)
    @DEField(name = "id" , isKeyField = true)
    @JsonProperty("id")
    @JSONField(name = "id")
    @ApiModelProperty(value = "id", notes = "应用标识")
    private String id;

    /**
     * 应用名称
     */
    @TableField(value = "name")
    @DEField(name = "name")
    @JsonProperty("name")
    @JSONField(name = "name")
    @ApiModelProperty(value = "name", notes = "应用名称")
    private String name;

    /**
     * dc
     */
    @TableField(value = "dc")
    @DEField(name = "dc")
    @JsonProperty("dc")
    @JSONField(name = "dc")
    @ApiModelProperty(value = "dc", notes = "dc")
    private String dc;

    /**
     * 认证地址
     */
    @TableField(value = "authentication_uri")
    @DEField(name = "authentication_uri")
    @JsonProperty("authentication_uri")
    @JSONField(name = "authentication_uri")
    @ApiModelProperty(value = "authentication_uri", notes = "认证地址")
    private String authenticationUri;

    /**
     * 认证方式
     */
    @TableField(value = "authentication_method")
    @DEField(name = "authentication_method" , dict = "Auth_provider_request_method")
    @JsonProperty("authentication_method")
    @JSONField(name = "authentication_method")
    @ApiModelProperty(value = "authentication_method", notes = "认证方式")
    private String authenticationMethod;

    /**
     * 认证基础配置
     */
    @TableField(value = "base_config")
    @DEField(name = "base_config")
    @JsonProperty("base_config")
    @JSONField(name = "base_config")
    @ApiModelProperty(value = "base_config", notes = "认证基础配置")
    private String baseConfig;

    /**
     * 响应类型
     */
    @TableField(value = "response_type")
    @DEField(name = "response_type" , dict = "Auth_provider_response_type")
    @JsonProperty("response_type")
    @JSONField(name = "response_type")
    @ApiModelProperty(value = "response_type", notes = "响应类型")
    private String responseType;

    /**
     * 响应成功标记
     */
    @TableField(value = "response_success_flag")
    @DEField(name = "response_success_flag")
    @JsonProperty("response_success_flag")
    @JSONField(name = "response_success_flag")
    @ApiModelProperty(value = "response_success_flag", notes = "响应成功标记")
    private String responseSuccessFlag;

    /**
     * 认证响应配置
     */
    @TableField(value = "response_config")
    @DEField(name = "response_config")
    @JsonProperty("response_config")
    @JSONField(name = "response_config")
    @ApiModelProperty(value = "response_config", notes = "认证响应配置")
    private String responseConfig;

    /**
     * 排序
     */
    @TableField(value = "sort")
    @DEField(name = "sort" , defaultValue = "100")
    @JsonProperty("sort")
    @JSONField(name = "sort")
    @ApiModelProperty(value = "sort", notes = "排序")
    private Integer sort;

    /**
     * 认证类型
     */
    @TableField(value = "authentication_type")
    @DEField(name = "authentication_type" , dict = "Auth_provider_type")
    @JsonProperty("authentication_type")
    @JSONField(name = "authentication_type")
    @ApiModelProperty(value = "authentication_type", notes = "认证类型")
    private String authenticationType;

    /**
     * 创建时间
     */
    @TableField(value = "create_time" , fill = FieldFill.INSERT)
    @DEField(name = "create_time" , preType = DEPredefinedFieldType.CREATEDATE)
    @JsonProperty("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "create_time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "create_time", notes = "创建时间")
    private Date createTime;

    /**
     * 创建人
     */
    @TableField(value = "creator" , fill = FieldFill.INSERT)
    @DEField(name = "creator" , preType = DEPredefinedFieldType.CREATEMAN)
    @JsonProperty("creator")
    @JSONField(name = "creator")
    @ApiModelProperty(value = "creator", notes = "创建人")
    private String creator;

    /**
     * 最后更新时间
     */
    @TableField(value = "update_time")
    @DEField(name = "update_time" , preType = DEPredefinedFieldType.UPDATEDATE)
    @JsonProperty("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "update_time" , format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "update_time", notes = "最后更新时间")
    private Date updateTime;

    /**
     * 最后更新人
     */
    @TableField(value = "updater")
    @DEField(name = "updater" , preType = DEPredefinedFieldType.UPDATEMAN)
    @JsonProperty("updater")
    @JSONField(name = "updater")
    @ApiModelProperty(value = "updater", notes = "最后更新人")
    private String updater;

    /**
     * 是否禁用
     */
    @TableField(value = "disabled")
    @DEField(name = "disabled" , defaultValue = "0" , dict = "YesNo")
    @JsonProperty("disabled")
    @JSONField(name = "disabled")
    @ApiModelProperty(value = "disabled", notes = "是否禁用")
    private Integer disabled;

    /**
     * 设置 [应用名称]
     */
    public AuthProvider setName(String name) {
        this.name = name;
        this.modify("name", name);
        return this;
    }

    /**
     * 设置 [dc]
     */
    public AuthProvider setDc(String dc) {
        this.dc = dc;
        this.modify("dc", dc);
        return this;
    }

    /**
     * 设置 [认证地址]
     */
    public AuthProvider setAuthenticationUri(String authenticationUri) {
        this.authenticationUri = authenticationUri;
        this.modify("authentication_uri", authenticationUri);
        return this;
    }

    /**
     * 设置 [认证方式]
     */
    public AuthProvider setAuthenticationMethod(String authenticationMethod) {
        this.authenticationMethod = authenticationMethod;
        this.modify("authentication_method", authenticationMethod);
        return this;
    }

    /**
     * 设置 [认证基础配置]
     */
    public AuthProvider setBaseConfig(String baseConfig) {
        this.baseConfig = baseConfig;
        this.modify("base_config", baseConfig);
        return this;
    }

    /**
     * 设置 [响应类型]
     */
    public AuthProvider setResponseType(String responseType) {
        this.responseType = responseType;
        this.modify("response_type", responseType);
        return this;
    }

    /**
     * 设置 [响应成功标记]
     */
    public AuthProvider setResponseSuccessFlag(String responseSuccessFlag) {
        this.responseSuccessFlag = responseSuccessFlag;
        this.modify("response_success_flag", responseSuccessFlag);
        return this;
    }

    /**
     * 设置 [认证响应配置]
     */
    public AuthProvider setResponseConfig(String responseConfig) {
        this.responseConfig = responseConfig;
        this.modify("response_config", responseConfig);
        return this;
    }

    /**
     * 设置 [排序]
     */
    public AuthProvider setSort(Integer sort) {
        this.sort = sort;
        this.modify("sort", sort);
        return this;
    }

    /**
     * 设置 [认证类型]
     */
    public AuthProvider setAuthenticationType(String authenticationType) {
        this.authenticationType = authenticationType;
        this.modify("authentication_type", authenticationType);
        return this;
    }

    /**
     * 设置 [是否禁用]
     */
    public AuthProvider setDisabled(Integer disabled) {
        this.disabled = disabled;
        this.modify("disabled", disabled);
        return this;
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("id");
        }
        return targetEntity;
    }

}